import store from '../store/index.js'

export function hasPermission(perms) {

    let hasPerms = false;
    //如果perms值为-1，不管什么权限按钮都置灰
    //如果perms值为1，不管什么权限按钮都不置灰
    if(perms === -1){
        return hasPerms;
    }
    else if(perms === 1){
        hasPerms = true;
        return hasPerms;
    }
    let btnMenu = store.state.btnMenu;

    if(btnMenu == null ||btnMenu.length == 0 ){

    }

    //console.log("btnMenu",btnMenu);
    //console.log("perms",perms);
    for (var i =0; i < btnMenu.length; i++){
        if (btnMenu[i].btnName === perms){
            hasPerms = true;
            break;
        }
    }
    return hasPerms;
}
